import sys

sys.path.append("../../")

from rpc.clean.filters import *
from rpc.context.ctx import *
from rpc.schema.Company import *

with collect_namespace("阿土伯_企业名录") as f:
    data = f.find()
    res = []
    for i in data:
        if filter_company(i["name"]):
            print(i["name"])
            res.append(Company(id=str(i["_id"]), name=i["name"]))
    MysqlSession.save(res)
